﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DAO;
using DTO;

namespace QuanLyCuaHangVideo
{
    public partial class frmThemNV : Form
    {
        public frmThemNV()
        {
            InitializeComponent();
        }

        private void btnThemNV_Click(object sender, EventArgs e)
        {
            NhanVien nv = new NhanVien();
            nv.HoTen = txtHoTenNV.Text.Trim();
            nv.Luong = float.Parse(txtLuong.Text.Trim());
            nv.CMND = txtCMNDNV.Text.Trim();
            nv.DiaChi = txtDiaChiNV.Text.Trim();
            nv.DienThoai = txtDienThoaiNV.Text.Trim();
            nv.LoaiNV = 0;
            nv.Username = txtUsername.Text.Trim();
            nv.Password = txtPassword.Text.Trim();
            bool kq = NhanVienDAO.ThemNV(nv);
            if (kq)
            {
                MessageBox.Show("Thêm nhân viên thành công!");
                txtHoTenNV.Text = "";
                txtLuong.Text = "";
                txtDiaChiNV.Text = "";
                txtCMNDNV.Text = "";
                txtDienThoaiNV.Text = "";
                txtUsername.Text = "";
                txtPassword.Text = "";
            }
            else
            {
                MessageBox.Show("Thêm thất bại!");
            }
        }

        private void btnDong_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
